<cd-alert-panel
  *ngIf="(snapScheduleModuleStatus$ | async) === false"
  type="info"
  spacingClass="mb-3"
  i18n
  class="align-items-center"
  actionName="Enable"
  (action)="enableSnapshotSchedule()"
>
  In order to access the snapshot scheduler feature, the snap_scheduler module must be enabled
</cd-alert-panel>

<ng-template
  #pathTpl
  let-row="data.row">
  <span
    class="fw-bold"
    [ngbTooltip]="fullpathTpl"
    triggers="click:blur">
    {{ row.pathForSelection?.split?.("@")?.[0] | path }}
  </span>

  <span
  *ngIf="row.active; else inactiveStatusTpl">
    <i
      [ngClass]="[icons.success, icons.large]"
      ngbTooltip="{{ row.pathForSelection?.split?.('@')?.[0] }} is active"
      class="text-success"
    ></i>
  </span>

  <ng-template #inactiveStatusTpl>
    <i
      [ngClass]="[icons.warning, icons.large]"
      class="text-warning"
      ngbTooltip="{{ row.pathForSelection?.split?.('@')?.[0] }} has been deactivated"
    ></i>
  </ng-template>

  <ng-template #fullpathForSelectionTpl>
    <span
      data-toggle="tooltip"
      [title]="row.pathForSelection"
      class="font-monospace"
      >{{ row.pathForSelection?.split?.("@")?.[0] }}
      <cd-copy-2-clipboard-button
        *ngIf="row.pathForSelection"
        [source]="row.pathForSelection?.split?.('@')?.[0]"
        [byId]="false"
        [showIconOnly]="true"
      >
      </cd-copy-2-clipboard-button>
    </span>
  </ng-template>
</ng-template>

<ng-template
  #retentionTpl
  let-row="data.row">
  <ul *ngIf="row.retentionCopy.length; else noDataTpl">
    <li *ngFor="let ret of row.retentionCopy">{{ ret }}</li>
  </ul>
</ng-template>

<ng-template
  #subvolTpl
  let-row="data.row">
  <span *ngIf="row.subvol; else noDataTpl">
    {{row.subvol}}
  </span>
</ng-template>



<ng-template #noDataTpl>-</ng-template>

<cd-table
  [data]="snapshotSchedules$ | async"
  *ngIf="snapScheduleModuleStatus$ | async"
  columnMode="flex"
  [columns]="columns"
  selectionType="single"
  [hasDetails]="false"
  (fetchData)="fetchData()"
  (updateSelection)="updateSelection($event)"
>
  <div class="table-actions">
    <cd-table-actions
      [permission]="permissions.cephfs"
      [selection]="selection"
      class="btn-group"
      [tableActions]="tableActions$ | async"
    >
    </cd-table-actions>
  </div>
</cd-table>
